// #pragma GCC optimize("Ofast","unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=620,M=2.2e5;
const ll INF=1e15,inf=1e10;

const ll L=1e5;
int n,m;
ll ans[L+5];
#define il inline
namespace Flow{
	int tot=1;
	int head[N],to[M],nxt[M];
	ll f[M],c[M];
	ll flow,cost;
	int lst[N],fr[N];
	ll dis[N];
	bitset<N> vis;
	int s,t;
	il void add(int x,int y,ll F,ll C){
		tot++,nxt[tot]=head[x],head[x]=tot,to[tot]=y,f[tot]=F,c[tot]=C;
		tot++,nxt[tot]=head[y],head[y]=tot,to[tot]=x,f[tot]=0,c[tot]=-C;
	}
	// il void clear(){
	// 	fill(head),
	// }
	il bool SPFA(){
		queue<int> q;
		fill(dis,dis+N,INF);dis[s]=0;
		vis.reset();
		q.push(s);vis[s]=1;
		while(!q.empty()){
			int x=q.front();q.pop();vis[x]=0;
			for(int i=head[x];i;i=nxt[i]){
				if(f[i]<=0) continue;
				if(dis[to[i]]>dis[x]+c[i]){
					dis[to[i]]=dis[x]+c[i];
					lst[to[i]]=i,fr[to[i]]=x;
					if(!vis[to[i]]) q.push(to[i]),vis[to[i]]=1;
				}
			}
		}
		if(dis[t]<0) return 1;
		else return 0;
	}
	il void push(){
		ll fl=inf;
		for(int x=t;x!=s;x=fr[x]){
			fl=min(fl,f[lst[x]]);
		}
		flow+=fl;
		for(int x=t;x!=s;x=fr[x]){
			f[lst[x]]-=fl;
			f[lst[x]^1]+=fl;
			cost+=c[lst[x]]*fl;
		}
	}
	il void max_flow(){
		while(1){
			SPFA();
			if(dis[t]>INF/2) break;
			push();
		}
	}
	il void min_cost_flow(){
		while(SPFA()) push();
	}
	il void updc(ll x){
		cost-=(c[2]-x)*(n-f[2]);
		c[2]=x,c[3]=-x;
	}
	il void solve(){
		int l=L+1,r=L+1;
		while(l>1){
			r=l-1;
			updc(r);
			min_cost_flow();
			ll d=dis[t];
			l=max(1ll,r-d);
			// assert(n-f[2]==flow);
			// cerr<<n-f[2]<<' '<<l<<' '<<r<<endl;
			for(ll i=l;i<=r;i++) ans[i]=cost-(r-i)*(n-f[2]);
		}
	}
}
using namespace Flow;
int u[90999],v[90999],w[90999];
mt19937 G(time(0));
#define r(x,y) uniform_int_distribution<int>(x,y)(G)
signed main(){
	/**
	freopen("journey.in","w",stdout);
	cout<<"300 90000 100000"<<endl;
	for(int i=1;i<=90000;i++){
		int x=r(1,300),y=r(1,300);while(x==y) y=r(1,300);
		cout<<x<<' '<<y<<' '<<r(0,10000)<<'\n';
	}
	for(int i=1;i<=100000;i++) cout<<i<<'\n';
	return 0;
	//*/
	// freopen("ex_journey5.in","r",stdin);
	freopen("journey.in","r",stdin);
	freopen("journey.out","w",stdout);
	cin.tie(nullptr)->sync_with_stdio(false);
	int i,q;
	cin>>n>>m>>q;if(q==0) return 0;
	for(i=1;i<=m;i++) cin>>u[i]>>v[i]>>w[i];
	add(2*n+1,2*n+2,n,1e5);
	for(i=1;i<=n;i++) add(2*n+2,i,1,0),add(i,i+n,inf,0),add(i+n,i,1,inf),add(i+n,2*n+3,inf,0);
	for(i=1;i<=m;i++) add(u[i]+n,v[i],inf,w[i]);
	// cerr<<clock()*1.0/CLOCKS_PER_SEC<<endl;
	s=2*n+4,t=2*n+5;
	int tcur=tot;
	for(i=1;i<=n;i++) add(s,i+n,1,0),add(i,t,1,0);
	max_flow();
	for(i=tcur+1;i<=tot;i++) f[i]=0;tot=tcur;
	s=2*n+1,t=2*n+3;flow=0;
	// cerr<<clock()*1.0/CLOCKS_PER_SEC<<endl;
	solve();
	while(q--) cin>>i,cout<<ans[i]<<'\n';
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<endl;
	return 0;
}